<?php
class Document{
	
	public function __get($key) {
		$key = str_replace("_", "/", $key);
		return Singleton::getSingleton($key);
	}
	
	public function front(){
		if (file_exists($this->engine_action->getFile())) {
			require_once($this->engine_action->getFile());
		
			$class = $this->engine_action->getClass();
		
			$controller = new $class();
		
			if (is_callable(array($controller, $this->engine_action->getMethod()))) {
				call_user_func_array(array($controller, $this->engine_action->getMethod()), $this->engine_action->getArgs());
				$this->response->renderResult();
			} else {
				
			}
		} else {
			//$action = $this->error;
		
			//$this->error = '';
		}
		
	}
	
}